//
//  aboutViewController.m
//  XDBaseFrameWork
//
//  Created by xindao on 14-9-24.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "aboutViewController.h"

@interface aboutViewController ()

@end

@implementation aboutViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.titleLabel.text = @"关于小鬼当佳";
    self.leftBtn.hidden = NO;
    self.contentView.backgroundColor = UIColorFromRGB(0xffffefa);


    // 滚动视图
    UIScrollView *scrollView = [[UIScrollView alloc] init];

    scrollView.frame = CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_SCREEN_HEIGHT);
//    scrollView.contentSize=CGSizeMake(UI_SCREEN_WIDTH,);

    // 设置背景颜色
    scrollView.backgroundColor=[UIColor clearColor];

    
    // 图片
    UIImageView *loginImage = [[UIImageView alloc]initWithFrame:CGRectMake((UI_SCREEN_WIDTH-90)/2, 30, 90, 90)];
    loginImage.backgroundColor = [UIColor orangeColor];
    loginImage.image = [UIImage imageNamed:@"Icon_ios7@2x.png"];
    loginImage.layer.masksToBounds = YES;
    loginImage.layer.cornerRadius = 8.0f;
    [scrollView addSubview:loginImage];


    // 图片下方文字
    UILabel *logoName = [[UILabel alloc]init];
//    logoName.frame = CGRectMake((UI_SCREEN_WIDTH-90)/2.0, height_y(loginImage)+10,100, 30);
     logoName.frame = CGRectMake(0, height_y(loginImage)+10,UI_SCREEN_WIDTH, 30);
    loginImage.backgroundColor = [UIColor redColor];

    logoName.textAlignment = NSTextAlignmentCenter;
    logoName.textColor = UIColorFromRGB(0xffb619);

    NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey];
    
    NSString *str = [NSString stringWithFormat:@"小鬼当佳V%@",version];
    logoName.text = str;
    logoName.font = [UIFont boldSystemFontOfSize:13];

    [scrollView addSubview:logoName];



    // 介绍
    UILabel *textLabel = [[UILabel alloc]init];

    CGFloat textLabelY =  CGRectGetMaxY(logoName.frame) + 3;
//    CGFloat textLabelH = UI_SCREEN_HEIGHT - textLabelY - 35;

//    textLabel.frame = CGRectMake(0,  textLabelY, UI_SCREEN_WIDTH, textLabelH -UI_NAVIGATION_BAR_HEIGHT);
//    textLabel.textAlignment = NSTextAlignmentCenter;
    textLabel.textColor = UIColorFromRGB(0x7b6f63);
    textLabel.font = [UIFont systemFontOfSize:14.0f];
    textLabel.text = @"      小鬼当佳是中国领先儿童摄影品牌，目前在线下7个城市拥有近50家高端儿童摄影门店。小鬼当佳最新推出的O2O业务让客户更轻松地享受人生影像记录服务。\n一、价格实惠：\n1）由于减少了线下销售等环节，客户可以以相当于影楼价格5折的价格享受到更加温馨周到的服务。\n2）更加透明的销售模式保证底片全送无任何后消，客户可以放心购买。\n3）无销售人员的自主消费保证客户选到最适合自己的摄影师。\n二、品质保障：\n1）每个摄影师使用真实的客片，避免影楼共用样片导致客户看到的样片和实际客片差别较大的问题。\n2）来自于客户的真实评价让客户能准确了解摄影师的技术和服务水平。同时也推动摄影师为了自己的信用记录而服务好每个客户。\n三、舒适便捷：\n1）下单到拍摄完成过程，客户只需要到店一次即可完成，影楼拍摄平均要到店五次方可完成";
    // 不可编辑
    textLabel.numberOfLines = 0;
    // 文字靠左侧
    textLabel.textAlignment = kCTLeftTextAlignment;

    // 计算文字高度
    CGFloat textLabelH = [self heightForString:textLabel.text fontSize:14.0 andWidth:UI_SCREEN_WIDTH - 10];
     textLabel.frame = CGRectMake(5,  textLabelY, UI_SCREEN_WIDTH - 10, textLabelH + 40);

    [scrollView addSubview:textLabel];



    // 版权信息
    UILabel *discripLabel = [[UILabel alloc]init];
    discripLabel.frame = CGRectMake(0, CGRectGetMaxY(textLabel.frame) + 5, UI_SCREEN_WIDTH, 30);
    discripLabel.textAlignment = NSTextAlignmentCenter;
    discripLabel.textColor = UIColorFromRGB(0x7b6f63);
    discripLabel.font = [UIFont systemFontOfSize:12.0f];
    discripLabel.text = @"©2014小鬼当佳 版权所有";
    [scrollView addSubview:discripLabel];


    scrollView.contentSize=CGSizeMake(UI_SCREEN_WIDTH,CGRectGetMaxY(discripLabel.frame) + 65);
    [self.contentView addSubview:scrollView];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (float)heightForString:(NSString *)value fontSize:(float)fontSize andWidth:(float)width
{
    CGSize sizeToFit = [value sizeWithFont:[UIFont systemFontOfSize:fontSize] constrainedToSize:CGSizeMake(width, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap];
    return sizeToFit.height;
}

@end
